package com.cxy.springbootelasticjob.job;


import com.cxy.autoconfig.ElasticSimpleJob;
import com.cxy.springbootelasticjob.listener.MyNormalListener;
import com.cxy.springbootelasticjob.sharding.MyshardingStrategy;
import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import lombok.extern.slf4j.Slf4j;

/**
 * @author: huayushu luming
 * @date: 2020-11-06 05:06
 * @desc:
 **/
@ElasticSimpleJob(
        jobName = "myShardingJob",
        cron = "0/10 * * * * ?",
        overwrite = true,
        shardingTotalCount = 10,
        jobStrategy = MyshardingStrategy.class,
        jobEvent = false,
        jobListener = {MyNormalListener.class,MyNormalListener.class}
)
@Slf4j
public class MyShardingJob implements SimpleJob {
    @Override
    public void execute(ShardingContext shardingContext) {
        log.info("我是分片项：{}",shardingContext.getShardingItem());
    }
}
